home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Online / Apache / include / apache / http_log.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-06  |  6.3 KB  |  164 lines

  1. /* ====================================================================
  2.  * The Apache Software License, Version 1.1
  3.  *
  4.  * Copyright (c) 2000 The Apache Software Foundation.  All rights
  5.  * reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  *
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  *
  14.  * 2. Redistributions in binary form must reproduce the above copyright
  15.  *    notice, this list of conditions and the following disclaimer in
  16.  *    the documentation and/or other materials provided with the
  17.  *    distribution.
  18.  *
  19.  * 3. The end-user documentation included with the redistribution,
  20.  *    if any, must include the following acknowledgment:
  21.  *       "This product includes software developed by the
  22.  *        Apache Software Foundation (http://www.apache.org/)."
  23.  *    Alternately, this acknowledgment may appear in the software itself,
  24.  *    if and wherever such third-party acknowledgments normally appear.
  25.  *
  26.  * 4. The names "Apache" and "Apache Software Foundation" must
  27.  *    not be used to endorse or promote products derived from this
  28.  *    software without prior written permission. For written
  29.  *    permission, please contact apache@apache.org.
  30.  *
  31.  * 5. Products derived from this software may not be called "Apache",
  32.  *    nor may "Apache" appear in their name, without prior written
  33.  *    permission of the Apache Software Foundation.
  34.  *
  35.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  36.  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  37.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  38.  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  39.  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  40.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  41.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  42.  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  43.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  44.  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  45.  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  46.  * SUCH DAMAGE.
  47.  * ====================================================================
  48.  *
  49.  * This software consists of voluntary contributions made by many
  50.  * individuals on behalf of the Apache Software Foundation.  For more
  51.  * information on the Apache Software Foundation, please see
  52.  * <http://www.apache.org/>.
  53.  *
  54.  * Portions of this software are based upon public domain software
  55.  * originally written at the National Center for Supercomputing Applications,
  56.  * University of Illinois, Urbana-Champaign.
  57.  */
  58.  
  59. #ifndef APACHE_HTTP_LOG_H
  60. #define APACHE_HTTP_LOG_H
  61.  
  62. #ifdef __cplusplus
  63. extern "C" {
  64. #endif
  65.  
  66. #ifdef HAVE_SYSLOG
  67. #include <syslog.h>
  68.  
  69. #define APLOG_EMERG     LOG_EMERG     /* system is unusable */
  70. #define APLOG_ALERT     LOG_ALERT     /* action must be taken immediately */
  71. #define APLOG_CRIT      LOG_CRIT      /* critical conditions */
  72. #define APLOG_ERR       LOG_ERR       /* error conditions */
  73. #define APLOG_WARNING   LOG_WARNING   /* warning conditions */
  74. #define APLOG_NOTICE    LOG_NOTICE    /* normal but significant condition */
  75. #define APLOG_INFO      LOG_INFO      /* informational */
  76. #define APLOG_DEBUG     LOG_DEBUG     /* debug-level messages */
  77.  
  78. #define APLOG_LEVELMASK LOG_PRIMASK   /* mask off the level value */
  79.  
  80. #else
  81.  
  82. #define    APLOG_EMERG    0    /* system is unusable */
  83. #define    APLOG_ALERT    1    /* action must be taken immediately */
  84. #define    APLOG_CRIT    2    /* critical conditions */
  85. #define    APLOG_ERR    3    /* error conditions */
  86. #define    APLOG_WARNING    4    /* warning conditions */
  87. #define    APLOG_NOTICE    5    /* normal but significant condition */
  88. #define    APLOG_INFO    6    /* informational */
  89. #define    APLOG_DEBUG    7    /* debug-level messages */
  90.  
  91. #define    APLOG_LEVELMASK    7    /* mask off the level value */
  92.  
  93. #endif
  94.  
  95. #define APLOG_NOERRNO        (APLOG_LEVELMASK + 1)
  96. #ifdef WIN32
  97. /* Set to indicate that error msg should come from Win32's GetLastError(),
  98.  * not errno. */
  99. #define APLOG_WIN32ERROR    ((APLOG_LEVELMASK+1) * 2)
  100. #endif
  101.  
  102. #ifndef DEFAULT_LOGLEVEL
  103. #define DEFAULT_LOGLEVEL    APLOG_WARNING
  104. #endif
  105.  
  106. #define APLOG_MARK    __FILE__,__LINE__
  107.  
  108. void ap_open_logs (server_rec *, pool *p);
  109.  
  110. /* The two primary logging functions, ap_log_error and ap_log_rerror,
  111.  * use a printf style format string to build the log message.  It is
  112.  * VERY IMPORTANT that you not include any raw data from the network,
  113.  * such as the request-URI or request header fields, within the format
  114.  * string.  Doing so makes the server vulnerable to a denial-of-service
  115.  * attack and other messy behavior.  Instead, use a simple format string
  116.  * like "%s", followed by the string containing the untrusted data.
  117.  */
  118. API_EXPORT(void) ap_log_error(const char *file, int line, int level,
  119.                  const server_rec *s, const char *fmt, ...)
  120.                 __attribute__((format(printf,5,6)));
  121. API_EXPORT(void) ap_log_rerror(const char *file, int line, int level,
  122.                  const request_rec *s, const char *fmt, ...)
  123.                 __attribute__((format(printf,5,6)));
  124. API_EXPORT(void) ap_error_log2stderr (server_rec *);     
  125.  
  126. void ap_log_pid (pool *p, char *fname);
  127. /* These are for legacy code, new code should use ap_log_error,
  128.  * or ap_log_rerror.
  129.  */
  130. API_EXPORT(void) ap_log_error_old(const char *err, server_rec *s);
  131. API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file,
  132.                  const char *msg, server_rec *s);
  133. API_EXPORT(void) ap_log_printf(const server_rec *s, const char *fmt, ...)
  134.                 __attribute__((format(printf,2,3)));
  135. API_EXPORT(void) ap_log_reason(const char *reason, const char *fname,
  136.                 request_rec *r);
  137.  
  138. typedef struct piped_log {
  139.     pool *p;
  140. #if !defined(NO_RELIABLE_PIPED_LOGS) || defined(TPF)
  141.     char *program;
  142.     int pid;
  143.     int fds[2];
  144. #else
  145.     FILE *write_f;
  146. #endif
  147. } piped_log;
  148.  
  149. API_EXPORT(piped_log *) ap_open_piped_log (pool *p, const char *program);
  150. API_EXPORT(void) ap_close_piped_log (piped_log *);
  151. #if !defined(NO_RELIABLE_PIPED_LOGS) || defined(TPF)
  152. #define ap_piped_log_read_fd(pl)    ((pl)->fds[0])
  153. #define ap_piped_log_write_fd(pl)    ((pl)->fds[1])
  154. #else
  155. #define ap_piped_log_read_fd(pl)    (-1)
  156. #define ap_piped_log_write_fd(pl)    (fileno((pl)->write_f))
  157. #endif
  158.  
  159. #ifdef __cplusplus
  160. }
  161. #endif
  162.  
  163. #endif    /* !APACHE_HTTP_LOG_H */
  164.